package com.engr.springbooteasypoi.thread;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class SheduleExecutors {

    public static void main(String[] args) {
        ScheduledExecutorService exec = Executors.newScheduledThreadPool(3);
        exec.scheduleAtFixedRate(()->{
            System.out.println(Thread.currentThread().getName() + "================");
        }, 1000, 5000, TimeUnit.MILLISECONDS);
        exec.scheduleAtFixedRate(() -> {
            System.out.println(Thread.currentThread().getName() + " ->" + System.nanoTime());
        }, 1000, 2000, TimeUnit.MILLISECONDS);
    }
}
